package cn.stronglink.assetmanage.business.inspection.presenter;

import java.io.IOException;
import java.util.List;

import cn.stronglink.assetmanage.MyApplication;
import cn.stronglink.assetmanage.R;
import cn.stronglink.assetmanage.business.inspection.model.RepairRegisterModel;
import cn.stronglink.assetmanage.business.inspection.view.resiger.RepairRegisterView;
import cn.stronglink.assetmanage.entity.Asset;
import cn.stronglink.assetmanage.entity.RepailDetail;
import cn.stronglink.assetmanage.entity.Repair;
import cn.stronglink.assetmanage.index.base.BasePresenter;
import okhttp3.Call;
import okhttp3.Response;

/**
 * Created by zhengjinglan on 2018/6/18.
 */

public class RepairRegisterPresenter   {
    private RepairRegisterView repairRegisterView;
    private RepairRegisterModel repairRegisterModel;


    /**
     * 显示详情页，需要跳转到详情页
     * @param sn
     */
    public void showDetailData(String sn){
        repairRegisterView.showWaitOrderDetail(sn);
    }

    public RepairRegisterPresenter(RepairRegisterView waitListView, RepairRegisterModel waitModel) {
        this.repairRegisterView = waitListView;
        this.repairRegisterModel = waitModel;
    }
 /*


    public RepairRegisterModel getCheckDetailModel() {
        return repairRegisterModel;
    }

    public void setCheckDetailModel(RepairRegisterModel checkDetailModel) {
        this.repairRegisterModel = checkDetailModel;
    }

    public RepairRegisterView getCheckDetailView() {
        return repairRegisterView;
    }

    public void setCheckDetailView(RepairRegisterView checkDetailView) {
        this.repairRegisterView = checkDetailView;
    }


    *//**
     * 显示数据
     *//*
    public void showData(String repair_id){
        Repair repair = repairRegisterModel.getRepairById(repair_id);
        repairRegisterView.showDetail(repair,repairRegisterModel.getUserIndex(repair.getOperatiorName()));
    }



    /**
     * 保存数据
     * @param repair
     *//*
    public void saveDetailData(Repair repair){

        Repair repair1 = repairRegisterView.saveRepair(repair);
        repairRegisterModel.saveCheckData(repair1);
    }
    @Override
    public void onFailure(Call call, IOException e) {
        repairRegisterView.hideProgressDialog();
        repairRegisterView.showToast(e.getMessage());
    }

    @Override
    public void onResponse(Call call, Response response) {
        repairRegisterView.hideProgressDialog();
        if(response.isSuccessful()){
            if(response.code()==200){

            }else{
                repairRegisterView.showToast(response.message());
            }
        }else{
            repairRegisterView.showToast(MyApplication.APP_CONTEXT.getString(R.string.get_data_fail));
        }
    }
    *//**
     *根据表单id显示表单中的资产列表
     * @param repair_id
     *//*
    public void showOrderDataByOrderId(String repair_id) {
        orderList = repairRegisterModel.getDataByOrderNo(repair_id);
        repairRegisterView.setOrderData(orderList);
    }*/
}
